﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace Egeye.AddIn
{
    public interface IBundleContext
    {
        /// <summary>
        /// Event raised when a bundle transition occurs.
        /// </summary>
        event BundleEventHandler BundleEvent;

        event ServiceEventHandler ServiceEvent;

        event FrameworkEventHandler FrameworkEvent;

        string GetProperty(string key);

        IBundle Bundle { get; }

        IBundle Install(string location);

        IBundle Install(string location, Stream inputStream);

        IBundle GetBundle(int id);

        IBundle[] Bundles { get; }

        IServiceRegistration RegisterService(string[] clazzes,
            object service, Dictionary<string, object> properties);

        IServiceRegistration RegisterService(string clazz,
            object service, Dictionary<string, object> properties);

        IServiceRegistration RegisterService(Type type,
            object service, Dictionary<string, object> properties);

        IServiceRegistration RegisterService<T>(object service,
            Dictionary<string, object> properties);

        IServiceReference[] GetServiceReferences(string clazz,
            string filter);

        IServiceReference[] GetAllServiceReferences(string clazz,
            string filter);

        IServiceReference GetServiceReference(string clazz);

        object GetService(IServiceReference reference);

        object GetService(string clazz);

        object GetService(Type type);

        T GetService<T>();

        bool UngetService(IServiceReference reference);

        FileSystemInfo GetDataFile(string filename);

        IFilter CreateFilter(string filter);

        bool IsAssignableTo(IServiceReference reference);
    }
}
